package service

import (
	"gin-vue-admin/global"
	"gin-vue-admin/model"
	"gin-vue-admin/model/request"
)

//@author: [piexlmax](https://github.com/piexlmax)
//@function: CreateBillList
//@description: 创建BillList记录
//@param: billList model.BillList
//@return: err error
func CreateCalendarPoint(cpoint model.CalendarPoint) (err error) {
	err = global.GVA_DB.Model(&model.CalendarPoint{}).Create(&cpoint).Error
	return err
}

//@author: [piexlmax](https://github.com/piexlmax)
//@function: DeleteBillListByIds
//@description: 批量删除BillList记录
//@param: ids request.IdsReq
//@return: err error
func DeleteCalendarPointByIds(ids request.IdsReq) (err error) {
	err = global.GVA_DB.Delete(&[]model.CalendarPoint{},"id in ?",ids.Ids).Error
	return err
}

func GetCalendarPointInfoList(info request.CalendarPointSearch) (err error, list interface{}, total int64) {
	limit := info.PageSize
	offset := info.PageSize * (info.Page - 1)
	// 创建db
	db := global.GVA_DB.Model(&model.CalendarPoint{})
	var cpoint []model.CalendarPoint
	err = db.Count(&total).Error
	err = db.Limit(limit).Offset(offset).Find(&cpoint).Error
	return err, cpoint, total
}
